﻿@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor HttpContextAccessor
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment WebHostEnvironment

@using Moonglade.Core
@{
    var currentController = ViewContext.RouteData?.Values["controller"]?.ToString();
}
<!DOCTYPE html>
<html>
<head>
    <title>
        @BlogConfig.GeneralSettings.SiteTitle Admin
        <environment exclude="Production">
            (@WebHostEnvironment.EnvironmentName)
        </environment>
    </title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <meta name="keywords" content="@Html.Raw(BlogConfig.GeneralSettings.MetaKeyword)" />
    <link rel="start" title="@BlogConfig.GeneralSettings.SiteTitle" href="~/" />
    <link rel="alternate" type="application/rss+xml" title="@BlogConfig.FeedSettings.RssTitle" href="~/rss" />
    <link type="application/opensearchdescription+xml" rel="search" title="@BlogConfig.GeneralSettings.SiteTitle" href="~/opensearch" />
    <partial name="_Favicons" />
    <link href="~/css/mooglade-css-bundle.min.css" rel="stylesheet" asp-append-version="true" />
    <script src="~/js/app/app-js-bundle.min.js" asp-append-version="true"></script>
    <script src="~/js/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/js/app/admin.js" asp-append-version="true"></script>
    @RenderSection("head", false)
    <environment include="Production">
        @Html.Raw(JavaScriptSnippet.FullScript)
    </environment>
    <link href="~/css/theme/@BlogConfig.GeneralSettings.ThemeFileName" rel="stylesheet" asp-append-version="true" />
</head>
<body class="admin-body">
    <div class="container-fluid full-height">
        <div class="row full-height">
            <aside class="admin-nav full-height col-12 col-sm-3">
                <div class="admin-avatar d-flex justify-content-center mt-4">
                    <img src="@Url.Action("Avatar", "Assets")"
                         alt="@BlogConfig.GeneralSettings.OwnerName"
                         class="rounded-circle blogger-head-pic" />
                </div>
                <div class="admin-user-info text-center mt-3 mb-3 text-light">
                    <h4>
                        @BlogConfig.GeneralSettings.OwnerName
                    </h4>
                    <p class="small text-moonglade-dark-secondary">@User.Identity.Name</p>
                </div>

                <hr class="admin-nav-divider" />

                <section class="admin-nav-section mt-3 mb-3">
                    <div class="list-group list-group-flush">
                        <a asp-controller="Post" asp-action="Manage" class="list-group-item list-group-item-action @(currentController == "Post" ? "active" : null)">
                            <span class="icon-file-text2"></span>
                            Posts
                        </a>
                        <a asp-controller="Category" asp-action="Manage" class="list-group-item list-group-item-action @(currentController == "Category" ? "active" : null)">
                            <span class="icon-folder"></span>
                            Categories
                        </a>
                        <a asp-controller="Comment" asp-action="Manage" class="list-group-item list-group-item-action @(currentController == "Comment" ? "active" : null)">
                            <span class="icon-bubbles3"></span>
                            Comments
                        </a>
                        <a asp-controller="Tags" asp-action="Manage" class="list-group-item list-group-item-action @(currentController == "Tags" ? "active" : null)">
                            <span class="icon-price-tag"></span>
                            Tags
                        </a>
                        <a asp-controller="CustomPage" asp-action="Manage" class="list-group-item list-group-item-action @(currentController == "CustomPage" ? "active" : null)">
                            <span class="icon-file-text2"></span>
                            Pages
                        </a>
                        <a asp-controller="Pingback" asp-action="Manage" class="list-group-item list-group-item-action @(currentController == "Pingback" ? "active" : null)">
                            <span class="icon-earth"></span>
                            Pingbacks
                        </a>
                        <a asp-controller="Settings" asp-action="GeneralSettings" class="list-group-item list-group-item-action @(currentController == "Settings" ? "active" : null)">
                            <span class="icon-cog"></span>
                            Settings
                        </a>
                    </div>
                </section>

                <hr class="admin-nav-divider" />

                <div class="text-center mt-3">
                    <a href="/" class="btn btn-sm btn-success">
                        Back to Website
                    </a>
                    <a asp-controller="Admin" asp-action="SignOut" class="btn btn-sm btn-danger">
                        Sign Out
                    </a>
                </div>
                <p class="text-moonglade-dark-secondary mt-4 small text-center">
                    Moonglade @Utils.AppVersion
                </p>
            </aside>
            <div class="admin-main full-height pt-4 col-sm col-12">
                @RenderBody()
            </div>
        </div>
    </div>
    @RenderSection("scripts", false)
</body>
</html>